﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NS.BLL;

namespace Admin.Admin.ShopMan
{
    public partial class AddShop : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            IsLogin();
        }

        protected void Add_Click(object sender, EventArgs e)
        {
            NS.BLL.Shops shopBll = new Shops();
            NS.Model.Shops shopModel=new NS.Model.Shops();
            shopModel.ShopName = ShopName.Text;
            shopModel.ShopSlogan = ShopSlogan.Text;
            shopModel.ShopIntro = ShopIntro.Text;
            shopModel.ShopNotice = ShopNotice.Text;
            shopModel.ShopAccount = Account.Text;
            shopModel.Password = Password.Text;
            shopModel.QQ = QQ.Text;
            shopModel.Age = Convert.ToInt32(Age.Text);
            shopModel.Location = Location.Text;
            shopModel.Height = Convert.ToInt32(Height.Text);
            shopModel.Weight = Convert.ToInt32(Weight.Text);
            shopModel.Job = Job.Text;
            shopModel.OnlineTime = OnlineTime.Text;
            shopModel.AddTime = DateTime.Now;
            shopModel.LastUpdateTime = DateTime.Now;
            shopModel.IsAvailable = 0;
            shopModel.IsDeleted = 0;
            int shopID = shopBll.Add(shopModel);
            if(shopID>0)
            {
                Maticsoft.Common.MessageBox.ShowAndRedirect(this,"添加成功","ShopList.aspx");
            }
            else
            {
                Maticsoft.Common.MessageBox.Show(this,"添加失败请重新添加。");
            }
        }
    }
}